Skip to content

fix(ui): remove-all routes skips locked routes (#1298)#1370

Open
iron-hope-shop wants to merge 2 commits intoAzgaar:masterfrom
iron-hope-shop:fix/remove-all-routes-respect-locks
Open

fix(ui): remove-all routes skips locked routes (#1298)#1370
iron-hope-shop wants to merge 2 commits intoAzgaar:masterfrom
iron-hope-shop:fix/remove-all-routes-respect-locks

Conversation

@iron-hope-shop
Copy link
Copy Markdown

Summary
"Remove all routes" in the Routes Overview now deletes only unlocked routes. Locked routes and their geometry stay. Users who want a full wipe can unlock everything first (existing lock/unlock-all control).

Motivation
Implements the behavior requested in #1298: bulk delete should ignore locked routes so you can clear generated routes without losing hand-pinned or important ones.

Changes

  • triggerAllRoutesRemove: filter !route.lock, call Routes.remove per unlocked route (keeps pack.cells.routes and SVG in sync).
  • If every route is locked: show a tip instead of opening the delete dialog.
  • If there are no routes: show a tip.
  • Confirmation copy clarifies counts when some routes stay locked.
  • Tooltip on the trash button: unlocked-only behavior.

How to test

  1. Lock one route → remove all → locked route remains.
  2. Unlock all → remove all → all removed.
  3. Lock all → remove all → tip, nothing deleted.

#1298

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 5, 2026

Deploy Preview for afmg ready!

Name Link
🔨 Latest commit 66e8d05
🔍 Latest deploy log https://app.netlify.com/projects/afmg/deploys/69d9509485577200084a7cfa
😎 Deploy Preview https://deploy-preview-1370--afmg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread public/modules/ui/routes-overview.js Outdated
@Azgaar
Copy link
Copy Markdown
Owner

Azgaar commented Apr 5, 2026

Looks good, thanks for the contribution!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Routes Overview “Remove all” action to respect route locks, enabling users to clear generated/unwanted routes without deleting hand-pinned (locked) ones, aligning bulk-delete behavior with issue #1298.

Changes:

  • Bulk delete now targets only unlocked routes and uses Routes.remove per route to keep data + SVG in sync.
  • Adds user feedback when there are no routes or when all routes are locked (tip instead of confirmation).
  • Updates confirmation wording and the trash button tooltip to clarify locked routes are retained.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/index.html Updates the Routes Overview trash button tooltip to clarify it removes only unlocked routes.
public/modules/ui/routes-overview.js Implements unlocked-only bulk deletion, adds empty/all-locked tips, and updates confirmation message/title accordingly.

Comment thread public/modules/ui/routes-overview.js Outdated
Comment thread public/modules/ui/routes-overview.js
@Azgaar
Copy link
Copy Markdown
Owner

Azgaar commented Apr 8, 2026

@iron-hope-shop, could you please address the comments? I will be able to merge then.

@iron-hope-shop
Copy link
Copy Markdown
Author

the remove action now recomputes unlocked routes at confirm time, and after bulk removal pack.cells.routes is rebuilt with Routes.buildLinks(pack.routes)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines +184 to +188
const lockedCount = pack.routes.length - toRemove.length;
alertMessage.innerHTML =
lockedCount > 0
? /* html */ `Remove all <b>unlocked</b> routes (${toRemove.length})? <b>${lockedCount}</b> locked route(s) will be kept. This cannot be undone.`
: /* html */ `Are you sure you want to remove all routes? This action can't be undone`;
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The confirmation text/title are derived from toRemove/lockedCount computed before opening the #alert dialog, but the actual deletion list is recomputed inside the Remove handler. Because jQuery UI dialogs are non-modal by default, users can lock/unlock additional routes while the dialog is open, which can make the confirmed counts inaccurate and potentially delete more routes than the prompt indicated. Consider making this dialog modal (or otherwise preventing lock state changes while it’s open), or ensure the deletion always matches the exact set/count presented in the confirmation UI.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants